var __extends =
    (this && this.__extends) ||
    (function () {
      var i = function (t, n) {
        return (i =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (i, t) {
              i.__proto__ = t;
            }) ||
          function (i, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (i[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function o() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        i(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((o.prototype = n.prototype), new o()));
      };
    })(),
  CountRoundView = (function (i) {
    function t() {
      var t = i.call(this) || this;
      return (
        (t.round1 = 0),
        (t.i1 = 0),
        (t.i2 = 1),
        (t.i3 = 2),
        (t.roundPosArr = [
          { x: 152, y: 29 },
          { x: 75, y: 62 },
          { x: 49, y: 137 },
          { x: 76, y: 210 },
          { x: 152, y: 239 },
          { x: 230, y: 208 },
          { x: 258, y: 137 },
          { x: 232, y: 62 },
        ]),
        t.btn_count_close.on(Laya.Event.CLICK, t, t.closeAction),
        t
      );
    }
    return (
      __extends(t, i),
      (t.openCountRoundView = function (i, n) {
        return (
          null == this.countRoundV &&
            ((this.countRoundV = new t()), (this.countRoundV.zOrder = 5e3)),
          (this.countRoundV.visible = !0),
          (this.countRoundV.caller = i),
          (this.countRoundV.method = n),
          this.countRoundV.initCountRound(),
          this.countRoundV
        );
      }),
      (t.prototype.closeAction = function () {
        this.method.call(this.caller), this.close();
      }),
      (t.prototype.initCountRound = function () {
        this.initData(),
          (this.timeDiff = 5e3),
          (this.round1 = 0),
          Laya.timer.loop(100, this, this.timerCountDownFn);
      }),
      (t.prototype.timerCountDownFn = function () {
        this.timeDiff--,
          this.timeDiff <= 0 && Laya.timer.clear(this, this.timerCountDownFn),
          this.round1 >= 8 && (this.round1 = 0),
          this.round1++,
          this.i1++,
          this.i1 >= this.roundPosArr.length && (this.i1 = 0),
          this.i2++,
          this.i2 >= this.roundPosArr.length && (this.i2 = 0),
          this.i3++,
          this.i3 >= this.roundPosArr.length && (this.i3 = 0),
          this.dealTweenTo();
      }),
      (t.prototype.dealTweenTo = function () {
        var i = this.roundPosArr[this.i1],
          t = this.roundPosArr[this.i2];
        this.roundPosArr[this.i2];
        Laya.Tween.to(this.round_image_0, { x: i.x, y: i.y }, 10),
          Laya.Tween.to(this.round_image_1, { x: t.x, y: t.y }, 10),
          Laya.Tween.to(this.round_image_2, { x: t.x, y: t.y }, 10);
      }),
      (t.prototype.showRoundResult = function (i, t, n) {
        var o = Utils.dealCompentResult(i, t, n),
          e = this.dealPerNumToBaGua(i),
          s = this.dealPerNumToBaGua(t),
          r = this.dealPerNumToBaGua(n);
        console.log(
          e +
            " = " +
            JSON.stringify(this.dealFrameRoundIndex(e)) +
            " **** " +
            s +
            JSON.stringify(this.dealFrameRoundIndex(s)) +
            " **** " +
            r +
            JSON.stringify(this.dealFrameRoundIndex(r))
        ),
          (this.timeDiff = 0),
          Laya.timer.clear(this, this.timerCountDownFn),
          Laya.Tween.to(this.round_image_0, this.dealFrameRoundIndex(e), 10),
          Laya.Tween.to(this.round_image_1, this.dealFrameRoundIndex(s), 10),
          Laya.Tween.to(this.round_image_2, this.dealFrameRoundIndex(r), 10),
          "太阳" == o
            ? (this.label_result_1.visible = !0)
            : "少阴" == o
            ? (this.label_result_2.visible = !0)
            : "太阴" == o
            ? (this.label_result_4.visible = !0)
            : "少阳" == o && (this.label_result_3.visible = !0),
          Laya.timer.once(3e3, this, this.onCloseAction);
      }),
      (t.prototype.onCloseAction = function () {
        this.close();
      }),
      (t.prototype.dealFrameRoundIndex = function (i) {
        var t;
        return (
          "乾" == i
            ? (t = { x: 152, y: 29 })
            : "兑" == i
            ? (t = { x: 75, y: 62 })
            : "离" == i
            ? (t = { x: 49, y: 137 })
            : "震" == i
            ? (t = { x: 76, y: 210 })
            : "坤" == i
            ? (t = { x: 152, y: 239 })
            : "艮" == i
            ? (t = { x: 230, y: 208 })
            : "坎" == i
            ? (t = { x: 258, y: 137 })
            : "巽" == i && (t = { x: 232, y: 62 }),
          t
        );
      }),
      (t.prototype.dealPerNumToBaGua = function (i) {
        var t = "";
        return (
          "1" == i
            ? (t = "乾")
            : "2" == i
            ? (t = "兑")
            : "3" == i
            ? (t = "离")
            : "4" == i
            ? (t = "震")
            : "5" == i
            ? (t = "坤")
            : "6" == i
            ? (t = "艮")
            : "7" == i
            ? (t = "坎")
            : "8" == i && (t = "巽"),
          t
        );
      }),
      (t.prototype.initData = function () {
        (this.round_image_3.skin = ""),
          (this.round_image_4.skin = ""),
          (this.round_image_5.skin = ""),
          (this.round_image_6.skin = ""),
          (this.round_image_7.skin = ""),
          (this.label_result_1.visible = !1),
          (this.label_result_2.visible = !1),
          (this.label_result_3.visible = !1),
          (this.label_result_4.visible = !1);
      }),
      (t.prototype.dealRoundView = function () {
        var i = "comp/happy/round_yellow.png",
          t = "comp/happy/round_pure.png";
        (this.round_image_0.skin = ""),
          (this.round_image_1.skin = ""),
          (this.round_image_2.skin = ""),
          (this.round_image_3.skin = ""),
          (this.round_image_4.skin = ""),
          (this.round_image_5.skin = ""),
          (this.round_image_6.skin = ""),
          (this.round_image_7.skin = "");
        1 == this.round1
          ? ((this.round_image_0.skin = t), (this.round_image_7.skin = i))
          : 2 == this.round1
          ? ((this.round_image_1.skin = t), (this.round_image_0.skin = i))
          : 3 == this.round1
          ? ((this.round_image_2.skin = t), (this.round_image_1.skin = i))
          : 4 == this.round1
          ? ((this.round_image_3.skin = t), (this.round_image_2.skin = i))
          : 5 == this.round1
          ? ((this.round_image_4.skin = t), (this.round_image_3.skin = i))
          : 6 == this.round1
          ? ((this.round_image_5.skin = t), (this.round_image_4.skin = i))
          : 7 == this.round1
          ? ((this.round_image_6.skin = t), (this.round_image_5.skin = i))
          : 8 == this.round1 &&
            ((this.round_image_7.skin = t), (this.round_image_6.skin = i));
      }),
      (t.prototype.close = function () {
        console.log("触发关闭 ========="),
          Laya.timer.clear(this, this.timerCountDownFn),
          (this.visible = !1);
      }),
      t
    );
  })(ui.Settings.CountRoundViewUI);
